﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Mechanics.GameEventMechanics {
    import Mechanics.*;
    import Classes.*;

    public class ZooUnlockDialogMechanic extends DialogGenerationMechanic {

        override public function canPopDialog():Boolean{
            var _local1:ZooEnclosure = (m_owner as ZooEnclosure);
            var _local2:Boolean;
            if (_local1){
                _local2 = super.canPopDialog();
                if (_local2){
                    if (m_config.params["skipAnimals"]){
                        _local2 = _local1.readyToUnlockMinusAnimals();
                    } else {
                        _local2 = _local1.readyToUnlock();
                    };
                };
            };
            return (_local2);
        }
        override public function executeOverrideForGameEvent(_arg1:String, _arg2:Array=null):MechanicActionResult{
            var _local3 = !(this.canPopDialog());
            var _local4:ZooEnclosure = (m_owner as ZooEnclosure);
            var _local5:MechanicActionResult = super.executeOverrideForGameEvent(_arg1, _arg2);
            if (!_local3){
                if (m_config.params["skipAnimals"]){
                    _local4.unlockNextEnclosure("readyToUnlockMinusAnimals");
                } else {
                    _local4.unlockNextEnclosure();
                };
            };
            return (new MechanicActionResult(_local5.actionSuccess, _local3, _local5.sendTransaction, _local5.transactionParams));
        }

    }
}//package Mechanics.GameEventMechanics 
